home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / metkit / k4view.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-07  |  23.9 KB  |  694 lines

  1. //    Copyright (C) 1996, 1997 Meta Four Software.  All rights reserved.
  2. //
  3. //    Views and other core class declarations
  4. //
  5. //! rev="$Id: k4view.h,v 1.21 1997/06/05 08:31:53 jcw Rel $"
  6.  
  7. #ifndef __K4VIEW_H__
  8. #define __K4VIEW_H__
  9.  
  10. #ifndef __K4CONF_H__
  11.     #error Please include "k4conf.h" before this header file
  12. #endif
  13.     
  14. /////////////////////////////////////////////////////////////////////////////
  15. // Declarations in this file
  16.  
  17.     class c4_View;                        // a view on underlying data
  18.     class c4_Cursor;                    // an index into a view
  19.     class c4_RowRef;                    // a reference to a row
  20.         class c4_Row;                    // one row in a view
  21.     class c4_Storage;                    // manages view persistence
  22.     class c4_Bytes;                     // used to pass around generic data
  23.  
  24.     class c4_Property;                    // for access inside rows
  25.         class c4_IntProp;
  26.         class c4_FloatProp;
  27.         class c4_DoubleProp;
  28.         class c4_StringProp;
  29.         class c4_BytesProp;
  30.         class c4_ViewProp;
  31.  
  32.         // defined in "k4viewx.h", included at the end of this file    
  33.     class c4_Sequence;
  34.     
  35.     class c4_Reference;
  36.         class c4_IntRef;
  37.         class c4_FloatRef;
  38.         class c4_DoubleRef;
  39.         class c4_StringRef;
  40.         class c4_BytesRef;
  41.         class c4_ViewRef;
  42.  
  43.     class c4_Persist;                    // not defined here
  44.     class c4_Strategy;                    // not defined here
  45.     class c4_Table;                     // not defined here
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. //: A collection of data rows.
  49. //
  50. //    Views act like pointers to the actual collections, setting a view to a new
  51. //    value does not alter the collection to which this view pointed previously.
  52. //
  53. //    The protocol used for this class mimics the way many other collection
  54. //    classes are defined. For example, when used with MFC, you will see member
  55. //    definitions such as c4_View::GetSize, c4_View::GetAt, c4_View::InsertAt.
  56. //
  57. //    The elements of views can be referred to by their 0-based index, which
  58. //    produces a row-reference of type c4_RowRef.  These row references can
  59. //    be copied, used to get or set properties, or dereferenced (in which case
  60. //    an object of class c4_Row is returned).  Taking the address of a row
  61. //    reference produces a c4_Cursor, which acts very much like a pointer.
  62. //
  63. //    The following code creates a view with 1 row and 2 properties:
  64. //
  65. //        c4_StringProp pName ("Name");
  66. //        c4_IntProp pAge ("Age");
  67. //
  68. //        c4_Row data;
  69. //        pName (data) = "John Williams";
  70. //        pAge (data) = 43;
  71. //
  72. //        c4_View myView;
  73. //        myView.Add(row);
  74.  
  75. class c4_View
  76. {
  77.     c4_Sequence* _seq;
  78.  
  79. public:
  80. /* Construction / destruction / assignment */
  81.     c4_View (c4_Sequence* implementation_ =0);
  82.         //: Constructs a view based on a sequence.
  83.     c4_View (const c4_Property& property_);
  84.         //: Constructs an empty view with one property.
  85.     c4_View (const c4_View& view_);
  86.         //: Constructs a view from another one.
  87.     ~c4_View ();
  88.     
  89.     c4_View& operator= (const c4_View& source_);
  90.         //: Makes this view the same as another one.
  91.  
  92. /* Getting / setting the number of rows */
  93.     int GetSize() const;    
  94.         //: Returns the number of entries.
  95.     int GetUpperBound() const;
  96.         //: Returns highest index (size - 1).
  97.    
  98.     void SetSize(int newSize_, int growBy_ =-1); 
  99.         //: Changes the size of this view.
  100.     void RemoveAll();
  101.         //: Removes all entries (sets size to zero).
  102.  
  103. /* Getting / setting individual elements */
  104.     c4_RowRef GetAt(int index_) const;
  105.         //: Returns a reference to specified entry.
  106.     c4_RowRef operator[] (int index_) const;
  107.         //: Shorthand for c4_View::GetAt.
  108.     
  109.     void SetAt(int index_, c4_RowRef row_);
  110.         //: Changes the value of the specified entry.
  111.     c4_RowRef ElementAt(int index_);
  112.         //: Element access, for use as RHS or LHS.
  113.     
  114. /* These can increase the number of rows */
  115.     void SetAtGrow(int index_, c4_RowRef row_);   
  116.         //: Sets an entry, growing the view if needed.
  117.     int Add(c4_RowRef row_);
  118.         //: Adds a new entry at the end.
  119.  
  120. /* Insertion / deletion of rows */
  121.     void InsertAt(int index_, c4_RowRef row_, int count_ =1);
  122.         //: Inserts one or more copies of an entry.
  123.     void RemoveAt(int index_, int count_ =1);
  124.         //: Removes entries starting at the given index.
  125.     void InsertAt(int index_, const c4_View& view_);
  126.         //: Inserts a copy of the contents of another view.
  127.  
  128. /* Dealing with the properties of this view */
  129.     int NumProperties() const; 
  130.         //: Returns the number of properties.
  131.     int NthProperty(int column_) const;
  132.         //: Returns the id of the N-th property.
  133.     int FindProperty(int id_);
  134.         //: Finds the index of a property, given its id.
  135.  
  136. /* Structural information */
  137.     c4_View Structure() const;
  138.         //: Returns a view which describes the structure of this view.
  139.     c4_String Describe() const;
  140.         //: Returns a description of the structure.
  141.     static c4_String Description(const c4_View& view_);
  142.         //: Returns a homogenized description of this view.
  143.  
  144.     c4_View Clone() const;
  145.         //: Constructs a new view with the same structure but no data.
  146.     void AddProperty(const c4_Property& property_);
  147.         //: Adds a property column to a view if not already present.
  148.     c4_View operator, (const c4_Property& property_) const;
  149.         //: Returns a view like the first, with a property appended to it.
  150.     
  151. /* Derived views */
  152.     c4_View Sort() const;
  153.         //: Creates view with all rows in natural (property-wise) order.
  154.     c4_View SortOn(const c4_View& order_) const;
  155.         //: Creates view sorted according to the specified properties.
  156.     c4_View SortOnReverse(const c4_View& order_, const c4_View& orderDown_) const;
  157.         //: Creates sorted view, with some properties sorted in reverse.
  158.  
  159.     c4_View Select(c4_RowRef criterium_) const;
  160.         //: Creates a view with rows matching the specified value.
  161.     c4_View SelectRange(c4_RowRef rowLow_, c4_RowRef rowHigh_) const;
  162.         //: Creates a view with row values within the specified range.
  163.  
  164.     c4_View Project(const c4_View& order_) const;
  165.         //: Creates a view with the specified property arrangement.
  166.     c4_View ProjectWithout(const c4_View& order_) const;
  167.         //: Creates a derived view with some properties omitted.
  168.  
  169.     int GetIndexOf(c4_RowRef row_) const;
  170.         //: Returns the index of the specified row in this view (or -1).
  171.  
  172. /* Searching */
  173.     int Find(c4_RowRef key_, int start_ =0) const;
  174.         //: Finds index of the the next entry matching the specified key.
  175.     int Search(c4_RowRef key_) const;
  176.         //: Searches for a key, using the native sort order of the view.
  177.     
  178. protected:
  179.     void _IncSeqRef();
  180.     void _DecSeqRef();
  181.  
  182.     friend class c4_ViewRef;
  183. };
  184.  
  185. /////////////////////////////////////////////////////////////////////////////
  186. //: An iterator for collections of rows (views).
  187. //
  188. //    Cursor objects can be used to point to specific entries in a view.
  189. //    A cursor acts very much like a pointer to a row in a view, and is 
  190. //    returned when taking the address of a c4_RowRef.  Dereferencing
  191. //    a cursor leads to the original row reference again.  You can construct a
  192. //    cursor for a c4_Row, but since such rows are not part of a collection,
  193. //    incrementing or decrementing these cursors is meaningless (and wrong). 
  194. //
  195. //    The usual range of pointer operations can be applied to these objects:
  196. //    pre/post-increment and decrement, adding or subtracting integer offsets,
  197. //    as well as the full range of comparison operators.    If two cursors
  198. //    point to entries in the same view, their difference can be calculated.
  199. //
  200. //    As with regular pointers, care must be taken to avoid running off of
  201. //    either end of a view (the debug build includes assertions to check this).
  202.  
  203. class c4_Cursor
  204. {
  205.     c4_Sequence* _seq;
  206.         /* Pointer to the sequence. */
  207.     int _index;
  208.         /* Current index into the sequence. */
  209.  
  210. public: 
  211. /* Construction / destruction / dereferencing */
  212.     c4_Cursor (c4_Sequence& implementation_, int index_);
  213.         //: Constructs a new cursor.
  214.     
  215.     c4_RowRef operator* () const;
  216.         //: Dereferences this cursor to "almost" a row.
  217.     
  218.     c4_RowRef operator[] (int index_) const;
  219.         //: This is the same as *(cursor + offset).
  220.  
  221. /* Stepping the iterator forwards / backwards */
  222.     c4_Cursor& operator++ ();
  223.         //: Pre-increments the cursor.
  224.     c4_Cursor operator++ (int);
  225.         //: Post-increments the cursor.
  226.     c4_Cursor& operator-- ();
  227.         //: Pre-decrements the cursor.
  228.     c4_Cursor operator-- (int);
  229.         //: Post-decrements the cursor.
  230.  
  231.     c4_Cursor& operator+= (int offset_);
  232.         //: Advances by a given offset.
  233.     c4_Cursor& operator-= (int offset_);
  234.         //: Backs up by a given offset.
  235.  
  236.     c4_Cursor operator- (int) const;
  237.         //: Subtracts a specified offset.
  238.     int operator- (c4_Cursor cursor_) const;
  239.         //: Returns the distance between two cursors.
  240.     
  241.     friend c4_Cursor operator+ (c4_Cursor cursor_, int offset_);
  242.         //: Adds specified offset.
  243.     friend c4_Cursor operator+ (int offset_, c4_Cursor cursor_);
  244.         //: Adds specified offset to cursor.
  245.  
  246. /* Comparing row positions */
  247.     friend bool operator== (c4_Cursor a_, c4_Cursor b_);
  248.         //: Returns true if both cursors are equal.
  249.     friend bool operator!= (c4_Cursor a_, c4_Cursor b_);
  250.         //: Returns true if both cursors are not equal.
  251.     friend bool operator< (c4_Cursor a_, c4_Cursor b_);
  252.         //: True if first cursor is less than second cursor.
  253.     friend bool operator> (c4_Cursor a_, c4_Cursor b_);
  254.         //: True if first cursor is greater than second cursor.
  255.     friend bool operator<= (c4_Cursor a_, c4_Cursor b_);
  256.         //: True if first cursor is less or equal to second cursor.
  257.     friend bool operator>= (c4_Cursor a_, c4_Cursor b_);
  258.         //: True if first cursor is greater or equal to second cursor.
  259.  
  260.     friend class c4_Reference;
  261.     friend class c4_Row;
  262.     friend class c4_RowRef;
  263.     friend class c4_View;
  264.  
  265.     friend class c4_Sequence;
  266.     friend class c4_FilterSeq;
  267.     friend class c4_SortSeq;
  268.  
  269.     friend bool operator== (c4_RowRef a_, c4_RowRef b_);
  270.     friend bool operator< (c4_RowRef a_, c4_RowRef b_);
  271. };
  272.  
  273. /////////////////////////////////////////////////////////////////////////////
  274. //: Reference to a data row, can be used on either side of an assignment.
  275. //
  276. //    Row references are created when dereferencing a c4_Cursor or when
  277. //    indexing an element of a c4_View.  Assignment will change the
  278. //    corresponding item.  Rows (objects of type c4_Row) are a special
  279. //    case of row references, consisting of a view with exactly one item.
  280. //
  281. //    Internally, row references are very similar to cursors, in fact they are
  282. //    little more than a wrapper around them.  The essential difference is one
  283. //    of semantics: comparing row references compares contents, copying row
  284. //    references copies the contents, whereas cursor comparison and copying
  285. //    deals with the pointer to the row, not its contents.
  286.  
  287. class c4_RowRef
  288. {
  289.     c4_Cursor _cursor;
  290.         /* A row reference is a cursor in disguise. */
  291.  
  292. public: 
  293. /* General operations */
  294.     c4_RowRef operator= (const c4_RowRef& row_);
  295.         //: Assigns the value of another row to this one.
  296.     c4_Cursor operator& () const;
  297.         //: Returns the cursor associated to this row.
  298.     c4_View Container() const;
  299.         //: Returns the underlying container view.
  300.  
  301. /* Comparing row contents */
  302.     friend bool operator== (c4_RowRef a_, c4_RowRef b_);
  303.         //: Returns true if the contents of both rows are equal.
  304.     friend bool operator!= (c4_RowRef a_, c4_RowRef b_);
  305.         //: Returns true if the contents of both rows are not equal.
  306.     friend bool operator< (c4_RowRef a_, c4_RowRef b_);
  307.         //: True if first row is less than second row.
  308.     friend bool operator> (c4_RowRef a_, c4_RowRef b_);
  309.         //: True if first row is greater than second row.
  310.     friend bool operator<= (c4_RowRef a_, c4_RowRef b_);
  311.         //: True if first row is less or equal to second row.
  312.     friend bool operator>= (c4_RowRef a_, c4_RowRef b_);
  313.         //: True if first row is greater or equal to second row.
  314.     
  315. protected:
  316.     c4_RowRef (c4_Cursor);
  317.  
  318.     friend class c4_Cursor;
  319.     friend class c4_Row;
  320. };
  321.  
  322. /////////////////////////////////////////////////////////////////////////////
  323. //: An entry in a collection with copy semantics.
  324. //
  325. //    Rows can exist by themselves and as the contents of views.    Row assignment
  326. //    implies that a copy of the contents of the originating row is made.
  327. //
  328. //    A row is implemented as an unattached view with exactly one element.
  329.  
  330. class c4_Row : public c4_RowRef 
  331. {
  332. public:
  333.     c4_Row ();
  334.         //: Constructs a row with no properties.
  335.     c4_Row (const c4_Row& row_);
  336.         //: Constructs a row from another one.
  337.     c4_Row (const c4_RowRef& row_);
  338.         //: Constructs a row copy from a row reference.
  339.     ~c4_Row ();
  340.     
  341.     c4_Row& operator= (const c4_Row& row_);
  342.         //: Assigns a copy of another row to this one.
  343.     c4_Row& operator= (const c4_RowRef& row_);
  344.         //: Copies another row to this one.
  345.     
  346.     void ConcatRow(const c4_RowRef& row_);
  347.         //: Adds all properties and values into this row.
  348.     friend c4_Row operator+ (const c4_RowRef& a_, const c4_RowRef& b_);
  349.         //: Returns a new row which is the concatenation of two others.
  350.     
  351. private:
  352.     static c4_Cursor Allocate();
  353.     static void Release(c4_Cursor);
  354. };
  355.  
  356. /////////////////////////////////////////////////////////////////////////////
  357. //: Manager for persistent storage of view structures.
  358. //
  359. //    The storage class uses a view, with additional functionality to be able 
  360. //    to store and reload the data it contains (including nested subviews).
  361. //
  362. //    By default, data is loaded on demand, i.e. whenever data which has
  363. //    not yet been referenced is used for the first time.  Loading is limited
  364. //    to the lifetime of this storage object, since the storage object carries
  365. //    the file descriptor with it that is needed to access the data file.
  366. //
  367. //    To save changes, call the Commit member.  This is the only time
  368. //    that data is written to file - when using a read-only file simply avoid
  369. //    calling Commit.
  370. //
  371. //    The LoadFromStream and SaveToStream members can be used to
  372. //    serialize the contents of this storage row using only sequential I/O
  373. //    (no seeking, only read or write calls).
  374. //
  375. //    The data storage mechanism implementation provides fail-safe operation:
  376. //    if anything prevents Commit from completing its task, the last
  377. //    succesfully committed version of the saved data will be recovered on
  378. //    the next open. This also includes changes made to the table structure. 
  379. //
  380. //    The following code creates a view with 1 row and stores it on file:
  381. //
  382. //        c4_StringProp pName ("Name");
  383. //        c4_IntProp pAge ("Age");
  384. //
  385. //        c4_Storage storage ("myfile.dat", true);
  386. //        c4_View myView = storage.GetAs("Musicians[Name:S,Age:I]");
  387. //
  388. //        myView.Add(pName ["John Williams"] + pAge [43]);
  389. //
  390. //        storage.Commit();
  391.  
  392. class c4_Storage 
  393. {
  394.     c4_Persist* _persist;
  395.     c4_Strategy* _cleanup;
  396.     bool (c4_Storage::*_fCommit) ();
  397.  
  398. public:
  399.     c4_Storage (c4_File* file_ =0); 
  400.         //: Constructs streaming-only or descriptor-based storage object.
  401.     c4_Storage (c4_Strategy& strategy_); 
  402.         //: Constructs a storage using the specified strategy handler.
  403.     c4_Storage (const char* filename_, const char* description_);
  404.         //: Constructs a storage object for given file and format.
  405.     c4_Storage (const char* filename_, bool canModify_);
  406.         //: Constructs a storage object, keeping the current structure.
  407.     ~c4_Storage ();
  408.     
  409.     void AutoCommit();
  410.         //: Sets storage up to always call Commit in the destructor.
  411.     c4_RowRef Contents() const;
  412.         //: Gives access to the stored data as a single row.
  413.  
  414.     c4_Strategy& Strategy() const;
  415.         //: Returns the strategy object associated with this storage.
  416.     c4_Table& RootTable() const;
  417.         //: Returns the root table entry.
  418.     c4_String Description() const;
  419.         //: Returns a description of the data structure.
  420.     
  421.     bool Commit();
  422.         //: Flushes pending changes to file right now.
  423.     bool Rollback();
  424.         //: (Re)initializes for on-demand loading.
  425.         // This will cancel all uncommitted changes.
  426.     
  427.     c4_ViewRef View(const char* name_) const;
  428.         //: Used to get or set a named view in this storage object.
  429.     c4_View GetAs(const char* description_);
  430.         //: Get a named view, redefining it to match the given structure.
  431.     c4_View Store(const char* name_, const c4_View& view_);
  432.         //: Attaches a view using specified name in this storage object.
  433.  
  434.     void LoadFromStream(void* _auxArg);
  435.         //: Loads contents from the specified input stream.
  436.     void SaveToStream(void* _auxArg);
  437.         //: Saves contents to the specified output stream.
  438.  
  439. private:
  440.     c4_Storage (const c4_Storage&);     // not implemented
  441.     void operator= (const c4_Storage&); // not implemented
  442.  
  443.     void Initialize(const char*, bool);
  444.     void SetStructure(const char*);
  445. };
  446.  
  447. /////////////////////////////////////////////////////////////////////////////
  448. //: Generic data buffer, with optional automatic clean up.
  449. //
  450. //    These objects are used to pass around untyped data without concern about
  451. //    clean-up.  They know whether the bytes need to be de-allocated when these
  452. //    objects go out of scope.  Small amounts of data are stored in the object.
  453. //
  454. //    Objects of this class are used a lot within MetaKit to manipulate its own
  455. //    data items generically.  The c4_BytesProp class allows storing binary
  456. //    data explicitly in a file.    If such data files must be portable, then the 
  457. //    application itself must define a generic format to deal with byte order.
  458. //
  459. //    How to store an object in binary form in a row (this is not portable):
  460. //
  461. //        struct MyStruct { ... };
  462. //        MyStruct something;
  463. //    
  464. //        c4_BytesProp pData ("Data");
  465. //        c4_Row row;
  466. //    
  467. //        pData (row) = c4_Bytes (&something, sizeof something);
  468.  
  469. class c4_Bytes
  470. {
  471.     t4_byte* _contents;
  472.     int _size;
  473.     bool _copy;
  474.  
  475.     enum { kMaxBuf = 16 };
  476.     t4_byte _buffer [kMaxBuf];
  477.  
  478. public:
  479.     c4_Bytes ();
  480.         //: Constructs an empty binary object.
  481.     c4_Bytes (const void* buffer_, int length_);
  482.         //: Constructs an object with contents, no copy.
  483.     c4_Bytes (const void* buffer_, int length_, bool makeCopy_);
  484.         //: Constructs an object with contents, optionally as a copy.
  485.     c4_Bytes (const c4_Bytes& bytes_);
  486.         //: Copy constructor.
  487.     ~c4_Bytes ();
  488.     
  489.     c4_Bytes& operator= (const c4_Bytes& bytes_);
  490.         //: Assignment, this may make a private copy of contents.
  491.     void Swap(c4_Bytes& bytes_);
  492.         //: Swaps the contents and ownership of two byte objects.
  493.     
  494.     int Size() const;
  495.         //: Returns the number of bytes of its contents.
  496.     const t4_byte* Contents() const;
  497.         //: Returns a pointer to the contents.
  498.     
  499.     t4_byte* SetBuffer(int length_);
  500.         //: Defines contents as a freshly allocated buffer of given size.
  501.     t4_byte* SetBufferClear(int length_);
  502.         //: Allocates a buffer and fills its contents with zero bytes.
  503.  
  504.     friend bool operator== (const c4_Bytes& a_, const c4_Bytes& b_);
  505.         //: Returns true if the contents of both objects are equal.
  506.     friend bool operator!= (const c4_Bytes& a_, const c4_Bytes& b_);
  507.         //: Returns true if the contents of both objects are not equal.
  508.  
  509. private:
  510.     void _MakeCopy();
  511.     void _LoseCopy();
  512. };
  513.  
  514. /////////////////////////////////////////////////////////////////////////////
  515. //: Base class for the basic data types.
  516. //
  517. //    Property objects exist independently of view, row, and storage objects.
  518. //    They have a name and type, and can be used by multiple views.
  519. //    You will normally only use derived classes for strong typing.
  520. //
  521. //    See: c4_IntProp, c4_FloatProp, c4_DoubleProp,
  522. //    c4_StringProp, c4_BytesProp, c4_ViewProp
  523.  
  524. class c4_Property
  525. {
  526.     int _id;
  527.  
  528. public:
  529.     c4_Property (char type_, const char* name_);
  530.         //: Constructs a new property with the give type and name.
  531.     c4_Property (int ide_);
  532.         //: Constructs a property from its id.
  533.     ~c4_Property ();
  534.     
  535.     c4_Property (const c4_Property& property_);
  536.         //: Copy constructor.
  537.     void operator= (const c4_Property& property_);
  538.         //: Assignment.
  539.  
  540.     c4_String Name() const;
  541.         //: Returns the name of this property.
  542.     char Type() const;
  543.         //: Returns the type of this property.
  544.  
  545.     int GetId() const;
  546.         //: Returns a unique id for this property.
  547.         // Properties with the same type and name always share the same id.
  548.  
  549.     c4_Reference operator() (c4_RowRef row_) const;
  550.         //: Gets or sets this untyped property in a row.
  551.  
  552.     void Refs(int) const;
  553.         //: Adjusts the reference count.
  554.  
  555.     c4_View operator, (const c4_Property& prop_) const;
  556.         //: Returns a view like the first, with a property appended to it.
  557. };
  558.  
  559.     //: Integer properties.
  560. class c4_IntProp : public c4_Property 
  561. {
  562. public:
  563.     c4_IntProp (const char* name_);
  564.         //: Constructs a new property.
  565.  
  566.     c4_IntRef operator() (c4_RowRef row_);
  567.         //: Gets or sets an integer property in a row.
  568.     t4_i32 Get(c4_RowRef row_);
  569.         //: Gets an integer property in a row.
  570.     void Set(c4_RowRef row_, t4_i32 value_);
  571.         //: Sets an integer property in a row.
  572.  
  573.     c4_Row operator[] (t4_i32 value_);
  574.         //: Creates a row with one integer, shorthand for AsRow.
  575.     c4_Row AsRow(t4_i32 value_);
  576.         //: Creates a row with one integer.
  577. };
  578.  
  579. #if !q4_TINY
  580.  
  581.     //: Floating point properties.
  582. class c4_FloatProp : public c4_Property 
  583. {
  584. public:
  585.     c4_FloatProp (const char* name_);
  586.         //: Constructs a new property.
  587.  
  588.     c4_FloatRef operator() (c4_RowRef row_);
  589.         //: Gets or sets a floating point property in a row.
  590.     double Get(c4_RowRef row_);
  591.         //: Gets a floating point property in a row.
  592.     void Set(c4_RowRef row_, double value_);
  593.         //: Sets a floating point property in a row.
  594.  
  595.     c4_Row operator[] (double value_);
  596.         //: Creates a row with one floating point value, shorthand for AsRow.
  597.     c4_Row AsRow(double value_);
  598.         //: Creates a row with one floating point value.
  599. };
  600.  
  601.     //: Double precision properties.
  602. class c4_DoubleProp : public c4_Property 
  603. {
  604. public:
  605.     c4_DoubleProp (const char* name_);
  606.         //: Constructs a new property.
  607.  
  608.     c4_DoubleRef operator() (c4_RowRef row_);
  609.         //: Gets or sets a double precision property in a row.
  610.     double Get(c4_RowRef row_);
  611.         //: Gets a double precision property in a row.
  612.     void Set(c4_RowRef row_, double value_);
  613.         //: Sets a double precision property in a row.
  614.  
  615.     c4_Row operator[] (double value_);
  616.         //: Creates a row with one double precision value, shorthand for AsRow.
  617.     c4_Row AsRow(double value_);
  618.         //: Creates a row with one double precision value.
  619. };
  620.  
  621. #endif // !q4_TINY
  622.  
  623.     //: String properties.
  624. class c4_StringProp : public c4_Property
  625. {
  626. public:
  627.     c4_StringProp (const char* name_);
  628.         //: Constructs a new property.
  629.  
  630.     c4_StringRef operator() (c4_RowRef row_);
  631.         //: Gets or sets a string property in a row.
  632.     c4_String Get(c4_RowRef row_);
  633.         //: Gets a string property in a row.
  634.     void Set(c4_RowRef row_, const char* value_);
  635.         //: Sets a string property in a row.
  636.  
  637.     c4_Row operator[] (const char* value_);
  638.         //: Creates a row with one string, shorthand for AsRow.
  639.     c4_Row AsRow(const char* value_);
  640.         //: Creates a row with one string.
  641. };
  642.  
  643.     //: Binary properties.
  644. class c4_BytesProp : public c4_Property
  645. {
  646. public:
  647.     c4_BytesProp (const char* name_);
  648.         //: Constructs a new property.
  649.  
  650.     c4_BytesRef operator() (c4_RowRef row_);
  651.         //: Gets or sets a bytes property in a row.
  652.     c4_Bytes Get(c4_RowRef row_);
  653.         //: Gets a bytes property in a row.
  654.     void Set(c4_RowRef row_, const c4_Bytes& value_);
  655.         //: Sets a bytes property in a row.
  656.  
  657.     c4_Row operator[] (const c4_Bytes& value_);
  658.         //: Create a row with one bytes object, shorthand for AsRow.
  659.     c4_Row AsRow(const c4_Bytes& value_);
  660.         //: Create a row with one bytes object.
  661. };
  662.  
  663.     //: View properties.
  664. class c4_ViewProp : public c4_Property
  665. {
  666. public:
  667.     c4_ViewProp (const char* name_);
  668.         //: Constructs a new property.
  669.  
  670.     c4_ViewRef operator() (c4_RowRef row_);
  671.         //: Gets or sets a view property in a row.
  672.     c4_View Get(c4_RowRef row_);
  673.         //: Gets a view property in a row.
  674.     void Set(c4_RowRef row_, const c4_View& value_);
  675.         //: Sets a view property in a row.
  676.  
  677.     c4_Row operator[] (const c4_View& value_);
  678.         //: Create a row with one view, shorthand for AsRow.
  679.     c4_Row AsRow(const c4_View& value_);
  680.         //: Create a row with one view.
  681. };
  682.  
  683. /////////////////////////////////////////////////////////////////////////////
  684.  
  685. #include "k4viewx.h"
  686.  
  687. #if q4_INLINE
  688.     #include "k4view.inl"
  689. #endif
  690.  
  691. /////////////////////////////////////////////////////////////////////////////
  692.  
  693. #endif
  694.